﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var list = new List<MyModel>();

            #region reg
            int no = 100;
            for (int i = 0; i < 10; i++)
            {
                list.Add(new MyModel()
                {
                    id = i,rowno=list.Count+1,
                    tickectno = no

                });
                no += 1;
            }

            no = 300;
            for (int i = 0; i < 10; i++)
            {
                list.Add(new MyModel()
                {
                    id = i,
                    rowno = list.Count + 1,
                    tickectno = no

                });
                no += 1;
            }

            no = 500;
            for (int i = 0; i < 10; i++)
            {
                list.Add(new MyModel()
                {
                    id = i,
                    rowno = list.Count + 1,
                    tickectno = no

                });
                no += 1;
            }
            #endregion

            string v = "";
            var query = from u in list
                        group u by u.tickectno - u.rowno into g
                        select g;

            var ss = "";

        }
         
    }
    class MyModel
    {
        public int id { get; set; }

        public int rowno { get; set; }
        public int tickectno { get; set; }
    }
     
}
